import { get, post, put, del } from '@/utils/request'

// 获取分类列表
export const getCategoriesAPI = () => {
  return get('/api/categories')
}

// 创建分类
export const createCategoryAPI = (data) => {
  return post('/api/categories', {
    name: data.name,
    description: data.description,
    color: data.color,
    icon: data.icon
  })
}

// 更新分类
export const updateCategoryAPI = (id, data) => {
  return put(`/api/categories/${id}`, data)
}

// 删除分类
export const deleteCategoryAPI = (id) => {
  return del(`/api/categories/${id}`)
}

// 获取分类详情
export const getCategoryDetailAPI = (id) => {
  return get(`/api/categories/${id}`)
}

// 获取分类统计
export const getCategoryStatsAPI = () => {
  return get('/api/categories/stats')
} 